<template>
  <div>
    <button @click="add">+</button>
    {{ $store.state.a.num2 }}
    <!-- <button @click="add2">+</button> -->
    {{ $store.state.num }}
  </div>
</template>

<script>
import { mapMutations } from 'vuex'
export default {
  methods: {
    add () {
      // this.$store.commit('a/addNum', 5)
      this.addNum(5);
    },
    // add2 () {
    //   this.$store.commit('addNum', 10)
    // },
    //...mapMutations(['a/addNum'])
    ...mapMutations('a',['addNum'])
  },
  mounted () {
    console.log(this.$store)
  },
}
</script>

<style lang="scss" scoped>

</style>
